<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增api分组')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-apiGroup-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">服务名称：</label>
				<div class="col-sm-8">
					<input id="apiGroupName" name="apiGroupName" class="form-control" type="text">
				</div>
			</div>
<!-- 			<div class="form-group">	 -->
<!-- 				<label class="col-sm-3 control-label">服务编号：</label> -->
<!-- 				<div class="col-sm-8"> -->
<!-- 					<input id="apiGroupCode" name="apiGroupCode" class="form-control" type="text"> -->
<!-- 				</div> -->
<!-- 			</div> -->
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="remark" name="remark" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "api/apiGroup"
		$("#form-apiGroup-add").validate({
			rules:{
				apiGroupName:{
					required:true,
					remote: {
                        url: prefix + "/checkNameUnique",
                        type: "post",
                        dataType: "json",
                        data: {
                        	apiGroupName : function() {
                                return $.common.trim($("#apiGroupName").val());
                            }
                        },
                        dataFilter: function(data, type) {
                        	return $.validate.unique(data);
                        }
                    }
				},
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-apiGroup-add').serialize(), function(){
	            	parent.queryGroupTree();
	            });
	        }
	    }
	</script>
</body>
</html>
